*********************************************
* This file contains code to replicate all  *
* tables in the main text and appendix of:  *
*                                           *
* "The Power to Hurt and the Effectiveness  *
* of International Sanctions"               *
*                                           *
* By Kerim Can Kavakli,                     *
* J. Tyson Chatagnier,                      *
* and Emre Hatipoglu                        *
*                                           *
* Forthcoming in the Journal of Politics    *
*                                           *
* File created 25 January 2019              *
*********************************************

** NOTE: Tables are not created in the exact order that they appear
**       in the text, as some tables rely on different data sets. 
**       The location of relevant code blocks is as follows:
**
**       Lines 26--286: Tables 2, A3, A4, A6, A7, A9, A10
**       Lines 289--330: Table A2
**       Lines 332--376: Table A5
**       Lines 379--412: Table A8

****************************
* LOAD replication dataset *
****************************

// cd ""
                        * Uncomment to specify working directory

use "power2hurt_JOP_replication_dataset.dta", clear
                        * Load file

preserve

********************
* TABLE 1: t-tests *
********************

keep if trade_related
                        * Limit analysis to trade-related sanctions

ttest targ_export_variety, by(sanction_success)
ttest targ_portfolio_concentration, by(sanction_success)
ttest targ_mpower_over_sender, by(sanction_success)
ttest sender_mpower_over_targ, by(sanction_success)
/* Note: Stata defaults to failed minus successful, and therefore the */
/* differences in the table will be the additive inverse of those     */
/* in the paper.                                                      */


************************************************
* TABLE 2: Logit Analysis of Sanctions Success *
************************************************

* Define macros to simplify the code
local controls 		"targ_totalgdp targ_gdppc targ_cinc targ_democracy coldwar security_issue coalition_size"

local main		    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration)"
local main_int	    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy)"
/* Note: There is 1 observation for which "targ_export_portfolio" is missing, but "trade_dependence" is not. To ensure that the regressions are done on precisely the same sample
and therefore they are comparable, we first run Model 2, then run Model 1 on Model 2's sample. Adding that 1 extra observation to Model 1 does not change the results. */
 
** MODEL 2: power to hurt **
quietly: logit sanction_success	 `controls' `main', cl(targetstate) robust
	est store tb1_m2

gen esample =e(sample)

lroc, nograph		

** MODEL 1: trade dependence **
quietly: logit sanction_success	 `controls' trade_dependence if esample ==1, cl(targetstate) robust
	est store tb1_m1

lroc, nograph
		
** MODEL 3: interaction term **
quietly: logit sanction_success	 `controls' `main_int', cl(targetstate) robust
	est store tb1_m3		

lroc, nograph

** MODEL 4: threat effectiveness **
logit sanction_threat_success `controls' `main_int' if sanction_threat_dummy ==1, cl(targetstate) robust
	est store tb1_m4

** MODEL 5: only imposed sanctions **
quietly: logit sanction_success	 `controls' `main_int' if imposed_sanction_dummy ==1, cl(targetstate) robust
	est store tb1_m5

restore

****************************************
* APPENDIX Table 1: Summary Statistics *
****************************************
	
sum sanction_success targ_totalgdp targ_gdppc targ_cinc targ_democracy			///
	coldwar security_issue coalition_size sender_mpower_over_targ 				///
	targ_mpower_over_sender targ_export_variety targ_portfolio_concentration	///
	if trade_related ==1
	
	
**********************************************
* APPENDIX Table 3: Different Specifications *
**********************************************

quietly: logit sanction_success	 `controls' `main_int' sender_export_variety if trade_related ==1, cl(targetstate) robust
	est store appx_tb3_m1
	
quietly: logit sanction_success	 `controls' `main_int' if trade_related ==1 | econ_agreement_sanction ==1, cl(targetstate) robust
	est store appx_tb3_m2
	
quietly: logit sanction_success	 `controls' `main_int' if trade_related ==1 & high_politics ==1, cl(targetstate) robust
	est store appx_tb3_m3

	
************************************************************
* APPENDIX Table 4: Additional Controls and Alternative DV *	
************************************************************

** Additional controls **
local extra		"smart_sanction us_primarysender igo_involved"
quietly: logit sanction_success	 `controls' `main_int' `extra', cl(targetstate) robust
	est store appx_tb4_m1

** Alternative DV **
logit altv_sanction_success `controls'  `main_int', cl(targetstate) robust
	est store appx_tb4_m2
	

*********************************************
* APPENDIX Table 6: Subset by Sanction Type *
*********************************************

** Baseline **
quietly: logit sanction_success	 `controls' `main_int', cl(targetstate) robust
	est store appx_tb6_m1
	
** Import restrictions **
logit sanction_success `controls'  `main_int' if import_sanction_threat ==1, cl(targetstate) robust
	est store appx_tb6_m2

** Export restrictions	 **
logit sanction_success `controls'  `main_int' if export_sanction_threat ==1, cl(targetstate) robust
	est store appx_tb6_m3

	
*************************************************************
* APPENDIX Table 7: Sanctions before and after the Cold War *
*************************************************************
			
** Cold War ** 
logit sanction_success	 `controls'  `main_int' if coldwar ==1, cl(targetstate) robust
	est store appx_tb7_m1

** Post-Cold War **
logit sanction_success	 `controls'  `main_int' if coldwar ==0, cl(targetstate) robust
	est store appx_tb7_m2
	
local maincw	 "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy)##i.coldwar"	
logit sanction_success	 `controls'  `maincw', cl(targetstate) robust
	est store appx_tb7_m3

		
******************************************************
* APPENDIX Table 9: Market Power vs Trade Dependence *
******************************************************
		
** Baseline **
quietly: logit sanction_success	 `controls' `main_int', cl(targetstate) robust
	est store appx_tb9_m1
	lroc, nograph

** Unweighted dependence **
quietly: logit sanction_success	 `controls' targ_*dep, cl(targetstate) robust
	est store appx_tb9_m2
	lroc, nograph
	
** Add variety and concentration **
quietly: logit sanction_success	 `controls' targ_*dep c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy, cl(targetstate) robust
	est store appx_tb9_m3	
	lroc, nograph
	
** Unweighted total dependence **
quietly: logit sanction_success	 `controls' trade_dependence, cl(targetstate) robust
	est store appx_tb9_m4	
	lroc, nograph
	
** Add variety and concentration **
quietly: logit sanction_success	 `controls' trade_dependence c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy, cl(targetstate) robust
	est store appx_tb9_m5	
	lroc, nograph	
		
	
**************************************************************************
* APPENDIX Table 10: Market Power vs Dependence (Only Imposed Sanctions) *
**************************************************************************
		
** Baseline **
quietly: logit sanction_success	 `controls' `main_int' if imposed_sanction_dummy ==1, cl(targetstate) robust
	est store appx_tb10_m1
	lroc, nograph

** Unweighted dependence **
quietly: logit sanction_success	 `controls' targ_*dep if imposed_sanction_dummy ==1, cl(targetstate) robust
	est store appx_tb10_m2
	lroc, nograph
	
** Add variety and concentration **
quietly: logit sanction_success	 `controls' targ_*dep c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy  if imposed_sanction_dummy ==1, cl(targetstate) robust
	est store appx_tb10_m3	
	lroc, nograph
	
** Unweighted total dependence **
quietly: logit sanction_success	 `controls' trade_dependence  if imposed_sanction_dummy ==1, cl(targetstate) robust
	est store appx_tb10_m4	
	lroc, nograph
	
** Add variety and concentration **	
quietly: logit sanction_success	 `controls' trade_dependence c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy if imposed_sanction_dummy ==1, cl(targetstate) robust
	est store appx_tb10_m5	
	lroc, nograph		
	
	
******************
* DISPLAY TABLES *
******************

***********
* TABLE 2 *
***********

esttab tb1_m1 tb1_m2 tb1_m3 tb1_m4 tb1_m5, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 				///
	order( trade_dependence sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration*)	///
	noomit nobase varwidth(40) mtitle compress label

************
* TABLE A3 *
************

esttab appx_tb3*, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 			///
	order( sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration* sender_export_variety)	///
	noomit nobase varwidth(40) mtitle compress label 
	
************
* TABLE A4 *
************

esttab appx_tb4*, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 			///
	order( sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration*)	///
	noomit nobase varwidth(40) mtitle compress label 
	
************
* TABLE A6 *
************

esttab appx_tb6*, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 			///
	order( sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration*)	///
	noomit nobase varwidth(40) mtitle compress label 	
	
************
* TABLE A7 *
************

esttab appx_tb7*, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 			///
	order( sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration* *coldwar*)	///
	noomit nobase varwidth(50) mtitle compress label 		

************
* TABLE A9 *
************

esttab appx_tb9*, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 			///
	order( sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration* targ*dep trade_dependence)	///
	noomit nobase varwidth(50) mtitle compress label 			
	
*************
* TABLE A10 *
*************

esttab appx_tb10*, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 			///
	order( sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration* targ*dep trade_dependence)	///
	noomit nobase varwidth(50) mtitle compress label 			


********************
* APPENDIX TABLE 2 *
********************

***********
* Model 1 *	
***********

* Load the file
use "power2hurt_JOP_replication_dataset_Table_A2_Model_1.dta", clear

keep if trade_related 

local controls 		"targ_totalgdp targ_gdppc targ_cinc targ_democracy coldwar security_issue coalition_size"
local main_int	    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy)"

quietly: logit sanction_success	 `controls' `main_int', cl(targetstate) robust
	est store tableA2_m1


***********
* Model 2 *	
***********

* Load the file
use "power2hurt_JOP_replication_dataset_Table_A2_Model_2.dta", clear

keep if trade_related 

local controls 		"targ_totalgdp targ_gdppc targ_cinc targ_democracy coldwar security_issue coalition_size"
local main_int	    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy)"

quietly: logit sanction_success	 `controls' `main_int', cl(targetstate) robust
	est store tableA2_m2	
	
************
* TABLE A2 *
************

esttab tableA2_m1 tableA2_m2, b(3) se(3) stats(N ll aic) star(* 0.1 ** 0.05 *** 0.01) 				///
	order( sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration*)	///
	noomit nobase varwidth(50) mtitle compress label 			

**********************************************
* APPENDIX Table 5: Heckman Selection Models *
**********************************************

use "power2hurt_JOP_replication_dataset_Table_A5.dta", clear

preserve

local main		    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration)"
local main_int	    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy)"
local main_sel		"(c.primesender_mpower_over_target c.target_mpower_over_primesender c.targ_export_variety cc.targ_portfolio_concentration##c.targ_democracy)"

local controls 		"targ_totalgdp targ_gdppc targ_cinc targ_democracy coldwar security_issue coalition_size"


** Model 1: Original Logit Model **
logit sanction_success 	`controls' `main_int' if trade_related ==1, cl(targetstate)
est store tbA5_m1

** Model 2: Logit UN Vote Nonmissing **
logit sanction_success 	`controls' `main_int' if trade_related ==1 & un_voting_similarity !=., cl(targetstate)
est store tbA5_m2

** Models 3 and 4: Heckman **
local controls_sel	"targ_totalgdp targ_gdppc targ_cinc targ_democracy coldwar c.un_voting_similarity"

heckprob sanction_success `main_int' `controls', 				///
	select(threat_or_imposition = `main_sel' `controls_sel' ) cl(targetstate)
	est store tbA5_m3

** Models 5 and 6: Heckman **	
local controls_sel	"targ_totalgdp targ_gdppc targ_cinc targ_democracy i.decade"

heckprob sanction_success `main_int' `controls', 				///
	select(threat_or_imposition = `main_sel' `controls_sel' ) cl(targetstate)
	est store tbA5_m5


************
* TABLE A5 *
************

esttab tbA5*, se(2) star(* 0.11 ** 0.05) noomit nobase compress		///
	varwidth(40) stats(N ll) mtitle label 		///
	order(*mpower* *variety* *portfolio*) drop(*cons* *decade*)  


*****************************************************************
* APPENDIX TABLE 8: Logit Analysis with only High RCA Countries *
*****************************************************************

use "power2hurt_JOP_replication_dataset_Table_A8.dta", clear

preserve

keep if trade_related 

local controls 		"targ_totalgdp targ_gdppc targ_cinc targ_democracy coldwar security_issue coalition_size"

local main		    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration)"
local main_int	    "(c.sender_mpower_over_targ c.targ_mpower_over_sender c.targ_export_variety c.targ_portfolio_concentration##c.targ_democracy)"

 
** MODEL 1 **
quietly: logit sanction_success	 `controls' `main', cl(targetstate) robust
	est store tbA8_m1
	
** MODEL 2 **
quietly: logit sanction_success	 `controls' `main_int', cl(targetstate) robust
	est store tbA8_m2

restore

************
* TABLE A8 *
************

* Table 8 in the Appendix
esttab tbA8_m1 tbA8_m2, b(3) se(3) stats(N ll) star(* 0.1 ** 0.05 *** 0.01) 				///
	order( trade_dependence sender_mpower_over_targ targ_mpower_over_sender targ_export_variety *targ_portfolio_concentration*)	///
	noomit nobase varwidth(40) mtitle compress label